構造
select name [in list]
do
statements that can use $name
done
in liat の各項目に番号を振る。
ユーザーに番号で入力を促す。
変数nameに選択結果を組み込み変数REPLYに選択番号を設定する
処理を永遠に実施する。do 実行開始指示
done 実行範囲終了
デフォルトで、"$@"が指定される。
終了は、breakを使用する。
例)
select()
{
PS3='directory? '
select selection in $DIR_STACK; do
if [ $selection ]; then
break
else
echo 'invalid selection.'
fi
done
}